home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / clib / free.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  1KB  |  62 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: free.c,v 1.2 1996/10/23 14:13:38 aros Exp $
  4.  
  5.     Desc: ANSI C function free()
  6.     Lang: english
  7. */
  8. #include <exec/memory.h>
  9. #include <clib/exec_protos.h>
  10. extern APTR __startup_mempool;
  11.  
  12. /*****************************************************************************
  13.  
  14.     NAME */
  15.     #include <memory.h>
  16.  
  17.     void free (
  18.  
  19. /*  SYNOPSIS */
  20.     void * memory)
  21.  
  22. /*  FUNCTION
  23.     Return memory allocated with malloc() or a similar function to the
  24.     system.
  25.  
  26.     INPUTS
  27.     memory - The result of the previous call to malloc(), etc. or
  28.         NULL.
  29.  
  30.     RESULT
  31.     None.
  32.  
  33.     NOTES
  34.  
  35.     EXAMPLE
  36.  
  37.     BUGS
  38.  
  39.     SEE ALSO
  40.     malloc()
  41.  
  42.     INTERNALS
  43.  
  44.     HISTORY
  45.     24-12-95    digulla created
  46.  
  47. ******************************************************************************/
  48. {
  49.     UBYTE * mem;
  50.     size_t size;
  51.  
  52.     if (memory && __startup_mempool)
  53.     {
  54.     mem = ((UBYTE *)memory) - AROS_ALIGN(sizeof(size_t));
  55.     size = *((size_t *)mem);
  56.  
  57.     FreePooled (__startup_mempool, mem, size);
  58.     }
  59.  
  60. } /* free */
  61.  
  62.